package com.ait.edu.controller;


import com.ait.commonutils.Msg;
import com.ait.edu.entity.Subject;
import com.ait.edu.entity.subject.OneSubject;
import com.ait.edu.service.SubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author testjava
 * @since 2021-06-10
 */
@RestController
@RequestMapping("/eduservice/subject")
public class SubjectController {

    @Autowired
    private SubjectService subjectService;


    @PostMapping("addSubject")
    public Msg addSubject(MultipartFile file){
        subjectService.saveSuobject(file,subjectService);
        return Msg.success();
    }

    @GetMapping("getAllSubject")
    public Msg getAllSubject(){
        //list是存一级参数
       List<OneSubject> list =  subjectService.getAllOneTwoSubject();

        return Msg.success().data("data1",list);
    }
}

